package cn.easybuy.service;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.easybuy.biz.ProductBiz;
import cn.easybuy.biz.Impl.ProductBizImpl;
import cn.easybuy.entity.Product;

public class ProductService extends HttpServlet {

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		request.setCharacterEncoding("utf-8");
		response.setContentType("text/html;charset=utf-8");
		String Id = request.getParameter("id");
		int i = Integer.parseInt(Id);
		ProductBiz productBiz = new ProductBizImpl();
		List<Product> list = productBiz.getProducts(i);
		HttpSession session = request.getSession();
		session.setAttribute("ProList", list);
		response.sendRedirect("../BrandList.jsp");

	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		this.doGet(request, response);
	}

}
